package com.tang.gulimall.product.dao;

import com.tang.gulimall.product.entity.CategoryEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 商品三级分类
 * 
 * @author tangdie
 * @email 2652839925@qq.com
 * @date 2021-01-16 19:32:58
 */
@Mapper
public interface CategoryDao extends BaseMapper<CategoryEntity> {


    @Select("SELECT\n" +
            "\ts1.cat_id,s1.name,\n" +
            "\ts2.cat_id,s2.name,\n" +
            "\ts3.cat_id,s3.name\n" +
            "FROM\n" +
            "\tpms_category s1 join pms_category s2 on s2.parent_cid = s1.cat_id\n" +
            "\tjoin pms_category s3 on s2.cat_id = s3.parent_cid")
    List<Object> selectlists();
}
